package com.xxl.baselib.util;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import java.util.List;
import java.util.Map;

public class FastJsonTools {

	public static String createJsonString(Object object) {
		return JSON.toJSONString(object);
	}

	public static <T> T createJsonBean(String jsonString, Class<T> cls) {
		return JSON.parseObject(jsonString, cls);
	}

	public static <T> List<T> createJsonToListBean(String jsonString, Class<T> cls) {
		return JSON.parseArray(jsonString, cls);
	}

	public static List<Map<String, Object>> createJsonToListMap(String jsonString) {
		return JSON.parseObject(jsonString, new TypeReference<List<Map<String, Object>>>() {
			
		});
	}

}
